#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>

int un_g_val;
int g_val=100;

int main(int argc,char* argv[],char* env[])
{
  printf("code addr           : %p\n",main);      //代码地址
  printf("init global addr    : %p\n",&g_val);    //初始化全局变量地址
  printf("uninit global addr  : %p\n",&un_g_val); //未初始化全局变量地址

  char* m1=(char*)malloc(50);
  char* m2=(char*)malloc(50);
  char* m3=(char*)malloc(50);
  char* m4=(char*)malloc(50);
  static int s = 100;
  printf("heap addr           : %p\n",m1);        //堆地址   
  printf("heap addr           : %p\n",m2);        //堆地址   
  printf("heap addr           : %p\n",m3);        //堆地址   
  printf("heap addr           : %p\n",m4);        //堆地址   
  printf("stack addr          : %p\n",&m1);       //栈地址
  printf("stack addr          : %p\n",&m2);       //栈地址
  printf("stack addr          : %p\n",&m3);       //栈地址
  printf("stack addr          : %p\n",&m4);       //栈地址
  
  printf("s stack addr        : %p\n",&s);        //静态变量地址在静态区


  int i=0;
  for( ; i < argc; i++ )
  {
  printf("argv addr           : %p\n",argv[i]);  //命令行参数地址
  }
  for( ; env[i]; i++ )
  {
  printf("env addr            : %p\n",env[i]);   //环境变量地址
  }
  return 0;
}
